<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="认领列表" libs=["table"]/>
<div class="container-div" id="_app">
	<div class="row">
        <div class="col-sm-12 search-collapse">
            <@f.form id="module-form">
                <div class="select-list">
                    <ul>
                        <li class="select-time">
                            <label>操作时间： </label>
                            <@f.input id="startTime" name="beginTime"/>
                            <span>-</span>
                            <@f.input name="endTime"/>
                        </li>
                        <!--<li>-->
                            <!--<@ctx.i18n text = "认领状态"/>：-->
                            <!--<@f.select name="claimStatus" dictType="claim_status" blankValue="" blankLabel="所有"/>-->
                        <!--</li>-->
                        <!--<li>-->
                            <!--<@ctx.i18n text = "到账金额"/>：-->
                            <!--<input type="text" class="form-control" name="arrivalAmount"/>-->
                        <!--</li>-->
                        <li >
                            <label>到账金额： </label>
                            <@f.input id="arrivalAmount" name="arrivalAmount1"/>
                            <span>-</span>
                            <@f.input name="arrivalAmount2"/>
                        </li>
                        <li>
                            <@ctx.i18n text = "汇款单位"/>：
                            <input type="text" class="form-control" name="remittanceUnit"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>  <@ctx.i18n text = "查询"/></a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="opt.form.reset()"><i class="fa fa-refresh"></i> <@ctx.i18n text = "重置"/></a>
                        </li>
                    </ul>
                </div>
            </@f.form>
           </div>

    <@table id="bootstrap-table">
    <@shiro.hasPermission name="bpm:claim:add">
    <a class="btn btn-success" onclick="opt.operate.add(0)">
        <i class="fa fa-plus"></i> <@ctx.i18n text = "新增"/>
    </a>
    </@shiro.hasPermission>
    <@shiro.hasPermission name="bpm:claim:edit">
    <a class="btn btn-primary" onclick="opt.operate.edit()">
        <i class="fa fa-edit"></i> <@ctx.i18n text = "修改"/>
    </a>
    </@shiro.hasPermission>
    <@shiro.hasPermission name="bpm:claim:del">
    <a class="btn btn-danger multiple disabled" onclick="opt.operate.delAll()">
        <i class="fa fa-remove"></i> <@ctx.i18n text = "删除"/>
    </a>
    </@shiro.hasPermission>
</@table>
    </div>
</div>
<@footer>
<script type="text/javascript">
    var statusDatas = ${dict.getDictListJson('claim_status')};
    var editFlag = "${permission.hasPermi("bpm:claim:edit")}";
    var listFlag = "${permission.hasPermi("bpm:claim:add")}";
    // var categoryDatas = ${dict.getDictListJson('sys_bpm_category')};
    var prefix = baseURL + "bpm/claim";

    $(function() {
        var options = {
            url: prefix + "/list",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            clickToSelect: true,
            sortName: "id",
            delUrl: prefix + "/del",
            addUrl: prefix + "/add",
            editUrl: prefix + "/edit/{id}",//认领箱
            uniqueId: 'id' , /* 唯一ID */
            modalName: "到账认领",
            columns: [
                // {field: 'selectItem', radio: true},
                {title: $.i18n.prop("序号"), width: 5, align: "center", formatter: function (value, row, index) {
                    return $.table.serialNumber(index);}},
                // {field : 'id',title : '<@ctx.i18n text = "编号"/>'},
                {field : 'claimStatus',title : '<@ctx.i18n text = "认领状态"/>',formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);}},
                {field : 'arrivalTime',title : '<@ctx.i18n text = "到账时间"/>'},
                {field : 'arrivalAmount',title : '<@ctx.i18n text = "到账金额"/>'},
                {field : 'remittanceUnit',title : '<@ctx.i18n text = "汇款单位"/>'},
                {field : 'remarks',title : '<@ctx.i18n text = "备注附言"/>'},
                {field : 'claimAmount',title : '<@ctx.i18n text = "已认领金额"/>'},
           //     {field : 'id',title : ''},

                {title:"<@ctx.i18n text = "操作"/>",align: 'left',class:'action',formatter: function(value, row, index) {
                        var actions = [];
                        // actions.push('<a class="" href="javascript:void(0)" title="<@ctx.i18n text = "关联流程表单"/>" onclick="taskFrom(\'' + row.id + '\')"><i class="fa icon-organization"></i></a> ');
                        //  actions.push('<a class="" href="javascript:void(0)" title="<@ctx.i18n text = "认领修改"/>" onclick="taskFromEdit(\'' + row.id + '\')">认领修改</a> ');
                        actions.push('<a class="' + editFlag + '" href="javascript:void(0)" title="<@ctx.i18n text = "认领修改"/>" onclick="preview(\'' + row.id + '\')">认领修改</a> ');
                        return actions.join('');
                }}
            ]
        };
        $.table.init(options);
    });



    function taskFromEdit(id) {
        // opt.modal.confirm("确认要删除流程定义吗?", function() {
      //  opt.modal.openTab(prefix + "/edit", { "id": id});
        console.log("1111111111");
        console.log(id);
        console.log("11111111");
        opt.modal.openTab("认领修改",prefix + "/editClaim/"+id);
        // })
    }

    function taskFrom(id){


        opt.modal.openTab("关联表单",prefix + "/taskfrom/"+id);
    }

    /*预览*/
    function preview(id) {
        console.log("111111111111111");
        // var options = {
        //     url: prefix + "/form/" + id,
        //     // title: '<i class="fa icon-picture"></i> <@ctx.i18n text = "流程图"/>',
        //     // btn:['<i class="fa fa-close"></i> '+$.i18n.prop("取消")],
        //     // width: $(top.window).width() - 300,
        //     // height: $(top.window).height() - 400
        // };
        // opt.modal.openMainWin(options);
        var url=prefix + "/editClaim/" + id;
        window.open(url)
    }

    /*预览XML*/
    function  preXml(id){
        var options = {
            url: prefix + "/xml/" + id,
            title:'<i class="fa fa-file-code-o"></i> <@ctx.i18n text = "BPMN2.0流程文件"/>',
            btn:['<i class="fa fa-close"></i> '+$.i18n.prop("取消")],
        };
        opt.modal.openMainWin(options);
    }

    /*生成代码*/
    function xmlDownload(id,name) {
        opt.modal.confirm("确定要下载[" + name + "]流程文件吗?", function() {
            location.href = prefix + "/download/" + id;
            opt.modal.msg('执行成功,正在下载请稍后…');
        })
    }
</script>
</@footer>
</@pageTheme>